package subumbo.demo.controller {
	import flash.display.DisplayObjectContainer;
	
	import org.robotlegs.mvcs.SignalContext;
	
	import subumbo.demo.controller.signal.LanguageChange;
	import subumbo.demo.controller.signal.PreviewSignal;
	import subumbo.demo.controller.signal.ShareSignal;
	import subumbo.demo.model.CopyModel;
	import subumbo.demo.model.WishModel;
	import subumbo.demo.service.CopyService;
	import subumbo.demo.service.LoadWishService;
	import subumbo.demo.service.WishService;
	import subumbo.demo.view.ViewPool;
	import subumbo.demo.view.firework.Firework;
	import subumbo.demo.view.firework.FireworkMediator;
	import subumbo.demo.view.logo.Logo;
	import subumbo.demo.view.logo.LogoMediator;
	import subumbo.demo.view.selector.Selector;
	import subumbo.demo.view.selector.SelectorMediator;
	import subumbo.demo.view.share.Share;
	import subumbo.demo.view.share.ShareMediator;
	import subumbo.demo.view.wishform.WishForm;
	import subumbo.demo.view.wishform.WishFormMediator;

	public class DemoContext extends SignalContext {
		
		public function DemoContext(contextView:DisplayObjectContainer=null, autoStartup:Boolean=true) {
			super(contextView, autoStartup);
		}
		
		public override function startup():void {
			
			injector.mapSingleton(ViewPool);
			injector.mapSingleton(CopyModel);
			injector.mapSingleton(CopyService);
			injector.mapSingleton(WishModel);
			injector.mapSingleton(WishService);
			injector.mapSingleton(LoadWishService);
			
			mediatorMap.mapView(WishForm, WishFormMediator);
			mediatorMap.mapView(Firework, FireworkMediator);
			mediatorMap.mapView(Selector, SelectorMediator);
			mediatorMap.mapView(Share, ShareMediator);
			mediatorMap.mapView(Logo, LogoMediator);
			
			signalCommandMap.mapSignalClass(LanguageChange, LanguageChangeCommand);
			signalCommandMap.mapSignalClass(PreviewSignal, PreviewCommand);
			signalCommandMap.mapSignalClass(ShareSignal, ShareCommand);
			
			commandMap.execute(StartupCommand);
		}
	}
}